package com.gl.emms.whale.ui;


import java.util.LinkedList;
import java.util.List;
import java.util.Random;




import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.gl.emms.whale.R;
import com.gl.emms.whale.app.Constant;
import com.gl.emms.whale.app.WhaleMonitorActivity;
import com.gl.emms.whale.util.MD5;
import com.gl.emms.whale.util.WeiXinUtil;
import com.gl.emms.whale.wxapi.PayActivity;
import com.gl.emms.whale.wxapi.WXEntryActivity;
import com.tencent.mm.sdk.constants.Build;
import com.tencent.mm.sdk.modelpay.PayReq;
import com.tencent.mm.sdk.openapi.IWXAPI;

public class RechargeActivity extends WhaleMonitorActivity implements
OnClickListener{
	private IWXAPI api;
	private Button mBtnWeixinPay;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题栏
		setContentView(R.layout.activity_recharge);
		Button titleBackBtn = (Button)findViewById(R.id.TitleBackBtn);  
		titleBackBtn.setOnClickListener(new OnClickListener() {  
			public void onClick(View v) {  
				KeyEvent newEvent = new KeyEvent(KeyEvent.ACTION_DOWN,  
						KeyEvent.KEYCODE_BACK);
				finish();
				//mActivity.onKeyDown(KeyEvent.KEYCODE_BACK, newEvent);  
			}  
		});
		mBtnWeixinPay = (Button) findViewById(R.id.weinxinpay_btn);
		mBtnWeixinPay.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.weinxinpay_btn:
			//boolean isPaySupported = api.getWXAppSupportAPI() >= Build.PAY_SUPPORTED_SDK_INT;
			//Toast.makeText(RechargeActivity.this, String.valueOf(isPaySupported), Toast.LENGTH_SHORT).show();
			//new GetAccessTokenTask().execute();
			//WeixinPay wxpay = new WeixinPay(RechargeActivity.this);
			startActivity(new Intent(RechargeActivity.this, PayActivity.class));
	        finish();
			break;

		default:
			break;
		}
	}

}
